<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common/head :: htmlhead">
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">博物馆详细信息</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" lay-filter="component-form-element">
                        <div hidden>
                            <input type="text" name="id" id="bwgid" lay-verify="required" hidden="hidden" th:value="${bwg.id}" autocomplete="off" class="layui-input">
                        </div><!--第一行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">工业博物馆名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="name" lay-verify="required" disabled th:value="${bwg.name}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">博物馆类别</label>
                                <div class="layui-input-block">
                                    <select name="museumtype" id="museumtype" lay-verify="required" lay-filter="museumType" disabled>
                                        <option value="综合类" th:selected="${bwg.museumtype}=='综合类'?'selected':null">综合类</option>
                                        <option value="行业类" th:selected="${bwg.museumtype}=='行业类'?'selected':null">行业类</option>
                                        <option value="企业类" th:selected="${bwg.museumtype}=='企业类'?'selected':null">企业类</option>
                                        <option value="高校及研究机构类" th:selected="${bwg.museumtype}=='高校及研究机构类'?'selected':null">高校及研究机构类</option>
                                        <option value="其他个人或团体" th:selected="${bwg.museumtype}=='其他个人或团体'?'selected':null">其他个人或团体</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg6" id="jibie" th:hidden="${bwg.museumjibie}=='无'?true:false">
                                <label class="layui-form-label">级别</label>
                                <div class="layui-input-block">
                                    <select name="museumjibie" id="museumjibie" lay-verify="required" disabled>
                                        <option value=""></option>
                                        <option value="国家级" th:selected="${bwg.museumjibie}=='国家级'?'selected':null">国家级</option>
                                        <option value="省级" th:selected="${bwg.museumjibie}=='省级'?'selected':null">省级</option>
                                        <option value="市级及以下" th:selected="${bwg.museumjibie}=='市级及以下'?'selected':null">市级及以下</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--第三行area-picker-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6" id="area-picker">
                                <label class="layui-form-label">省市</label>
                                <div class="layui-input-inline layui-col-lg3">
                                    <select name="province" id="province" class="province-selector" lay-filter="province-1" disabled>
                                        <option th:value="${bwg.province}" th:text="${bwg.province}"></option>
                                    </select>
                                </div>
                                <div class="layui-input-inline layui-col-lg3" >
                                    <select name="city" id="city" class="city-selector" lay-filter="city-1"disabled>
                                        <option th:value="${bwg.city}" th:text="${bwg.city}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg4">
                                <label class="layui-form-label">详细地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="fulladdress" lay-verify="required" disabled th:value="${bwg.fulladdress}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第四行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">邮编</label>
                                <div class="layui-input-block">
                                    <input type="text" name="postcode" lay-verify="required" disabled th:value="${bwg.postcode}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">所属行业</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" readonly="readonly"type="text" name="industrytype" id="hangye" disabled th:value="${bwg.industrytype}"
                                           onkeyup="IndustrialClassification()" onclick="IndustrialClassification()" lay-verify="required">
                                    <input type="hidden" id="hangyetag" value="0">
                                </div>
                            </div>
                        </div>
                        <!--第六行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">联系人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="linker" lay-verify="required" disabled th:value="${bwg.linker}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">职务</label>
                                <div class="layui-input-block">
                                    <input type="text" name="linkerjob" lay-verify="required" disabled th:value="${bwg.linkerjob}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第七行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">手机</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mobilephone" lay-verify="required|phone" disabled th:value="${bwg.mobilephone}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">电话</label>
                                <div class="layui-input-block">
                                    <input type="text" name="phone" lay-verify="required" disabled th:value="${bwg.phone}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第八行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">传真</label>
                                <div class="layui-input-block">
                                    <input type="text" name="fax" lay-verify="required" disabled th:value="${bwg.fax}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">电子邮箱</label>
                                <div class="layui-input-block">
                                    <input type="text" name="email" lay-verify="required|email" disabled th:value="${bwg.email}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第九行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法定代表人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="faren" lay-verify="required" disabled th:value="${bwg.faren}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">是否为独立法人</label>
                                <div class="layui-input-block" disabled id="isselffaren">
                                    <input type="radio" disabled name="isselffaren" value="1" title="是" th:checked="${bwg.isselffaren}==1?true:false">
                                    <input type="radio" disabled name="isselffaren"  value="0" title="否" th:checked="${bwg.isselffaren}==0?true:false">
                                </div>
                            </div>
                        </div>
                        <!--第十行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">统一社会信用代码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="creditcode" lay-verify="required" disabled th:value="${bwg.creditcode}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">举办人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="organizer" lay-verify="required" disabled th:value="${bwg.organizer}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十一行-->
                        <!--<div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法人登记类型</label>
                                <div class="layui-input-block">
                                    <input type="text" name="farentype" lay-verify="required" disabled th:value="${bwg.farentype}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法人登记机关</label>
                                <div class="layui-input-block">
                                    <input type="text" name="farenoffice" lay-verify="required" disabled th:value="${bwg.farenoffice}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>-->
                        <!--第十二行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">馆舍面积（平方米）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="buildingarea" lay-verify="required" disabled th:value="${bwg.buildingarea}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">展示面积（平方米）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="showarea" lay-verify="required" disabled th:value="${bwg.showarea}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十三行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">藏品数量（件）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="cangpinnum" lay-verify="required" disabled th:value="${bwg.cangpinnum}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">从业人数（人）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="employeenum" lay-verify="required" disabled th:value="${bwg.employeenum}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十四行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">全年开放天数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="opendays" lay-verify="required" disabled th:value="${bwg.opendays}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">是否免费开放</label>
                                <div class="layui-input-block" disabled id="isfreeopen">
                                    <input type="radio" disabled name="isfreeopen" value="1" title="是" th:checked="${bwg.isfreeopen}==1?true:false">
                                    <input type="radio" disabled name="isfreeopen" value="0" title="否" th:checked="${bwg.isfreeopen}==0?true:false">
                                </div>
                            </div>
                        </div>
                        <!--第十五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">上一年参观人次（万人次）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="vistornum" lay-verify="required" disabled th:value="${bwg.vistornum}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">上一年举办活动次数（次/年）</label>
                                <div class="layui-input-block">
                                    <input type="number" name="propagandanum" lay-verify="required" disabled th:value="${bwg.propagandanum}"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--单位简介-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">单位简介</label>
                                <div class="layui-input-block">
                                    <textarea name="unitintroduction" disabled th:text="${bwg.unitintroduction}" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" id="userid"  th:value="${bwg.userid}" class="layui-input">
                        <!--注册资料页面显示-->
                        <div class="layui-form-item" th:hidden="${page}=='register'?false:true">
                            <div class="layui-input-block" id="btn_m">
                                <button class="layui-btn" id="modify" type="button">修改</button>
                            </div>
                            <div class="layui-input-block" hidden="true" id="btn_s">
                                <button class="layui-btn" id="submit" lay-submit lay-filter="formsubmit">提交</button>
                            </div>
                        </div>
                        <!--注册审核页面显示-->
                        <div class="layui-form-item" th:hidden="${page}=='check'?false:true">
                            <div class="layui-row layui-col-space10 layui-form-item">
                                <div class="layui-col-lg10">
                                    <label class="layui-form-label">审核文件</label>
                                    <div class="layui-input-block">
                                        <a target="_blank" th:href="'../'+${file1.getFileid()}">审核文件</a>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-row layui-col-space10 layui-form-item" th:hidden="${file2}==null?true:false">
                                <div class="layui-col-lg10">
                                    <label class="layui-form-label">其他文件</label>
                                    <div class="layui-input-block">
                                        <a target="_blank" th:href="${file2}==null?null:${'../'+file2.getFileid()}">其他文件</a>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-input-block">
                                <button class="layui-btn" id="tongguo" type="button">审核通过并分配角色</button>
                                <button class="layui-btn layui-btn-danger" id="butongguo" type="button">审核不通过</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--审核通过弹框-->
<div class="site-text" style="margin: 5%; display: none" id="check_tg">
    <div class="layui-form" action="" lay-filter="check_tg_form">
        <input type="hidden" name="id" id="userid_r" class="layui-input" >
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block" id="mycheckbox">

            </div>
        </div>
        <div class="layui-form-item" hidden>
            <div class="layui-input-block">
                <button id="check_tg_submit" class="layui-btn" lay-submit lay-filter="check_tg_submit">
                    审核通过
                </button>
            </div>
        </div>
    </div>
</div>
<!--审核不通过弹框-->
<div class="site-text" style="margin: 5%; display: none" id="check_butg">
    <div class="layui-form" action="" lay-filter="check_butg_form">
        <input type="hidden" name="id" id="userid_b" class="layui-input" >
        <div class="layui-form-item">
            <label class="layui-form-label">审核意见</label>
            <div class="layui-input-block">
                <textarea name="shenheyijian" lay-verify="required" autocomplete="off" placeholder="请输入审核意见" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item" hidden>
            <div class="layui-input-block">
                <button id="check_butg_submit" class="layui-btn" lay-submit lay-filter="check_butg_submit">
                    审核不通过
                </button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: '/static/lib/' //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index', 'form','layarea'], function(){
        var admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,form = layui.form
            ,layarea = layui.layarea
            ,$ = layui.jquery;

        $('#modify').click(function () {
            $('input').removeAttr("disabled");
            $('textarea').removeAttr("disabled");
            $('#museumtype').removeAttr("disabled")
            $('#museumjibie').removeAttr("disabled");
            $('#isselffaren').removeAttr("disabled");
            $('#isfreeopen').removeAttr("disabled");
            $('#province').removeAttr("disabled");
            $('#city').removeAttr("disabled");
            $('#unittype').removeAttr("disabled");
            $('#btn_m').attr("hidden",true);
            $('#btn_s').attr("hidden",false);
            $('#fileshow').hide();
            $('#fileupload').show();

            form.render();
            $("html,body").animate({"scrollTop":0});

        });

        form.on('select(museumType)', function(data){
            var val=data.value;
            if(val=="综合类" || val=="行业类"){
                $("#jibie").show();
                layui.form.render('select');
            }else{
                $("#jibie").hide();
                $('#museumjibie').val('无');
                layui.form.render('select');
            }
        });

        layarea.render({
            elem: '#area-picker',
            data:{
                province: $("#province").val(),
                city: $("#city").val()
            },
            change: function (res) {

            }

        });

        form.render(null, 'formsubmit');
        element.render('breadcrumb', 'breadcrumb');

        form.on('submit(formsubmit)', function(data){
            $.ajax({
                url:"/xqmodify_bwg/register",
                async: false,
                type:"POST",
                dataType: "text",
                data:data.field,
                success: function(data){
                    if(data==="success_bwg"){
                        layer.open({
                            title: '修改成功'
                            ,content: '信息已修改！'
                            ,yes: function(index, layero){
                                window.parent.location.reload();
                            }
                        });
                    }
                }
            });
            return false;
        });

        $('#tongguo').click(function () {
            layer.open({
                type: 1
                ,skin: 'layui-layer-molv'
                ,area: ['40%', '60%']
                ,title: ['请选择要分配的角色','font-size:18px']
                ,btn: ['通过并分配角色', '取消']
                ,shadeClose: true
                ,shade: 0 //遮罩透明度
                ,maxmin: true //允许全屏最小化
                ,content:$("#check_tg")  //弹窗路径
                ,success:function(layero,index){
                    $.ajax({
                        url:"/getRoleList",
                        async: false,
                        type:"POST",
                        dataType: "text",
                        success: function(res){
                            var roleList = jQuery.parseJSON(res).roleList;
                            if(roleList&&roleList.length>0){
                                for(var i = 0; i < roleList.length;i++){
                                    var roleid = roleList[i].id;
                                    var rolename = roleList[i].name;
                                    $("#mycheckbox").append("<input name='role' type='checkbox' lay-skin='primary' title='"+rolename+"' value='"+roleid+"' ><br>");
                                }
                            }
                        }
                    });
                    $("#userid_r").attr("value",$('#userid').val());
                    form.render(null, 'check_tg_form');

                }
                ,yes : function(index, layero) { // 确认按钮回调函数
                    form.on('submit(check_tg_submit)', function(data) {
                        if ($("input:checkbox[name='role']:checked").length == 0) {
                            alert("请先选择要分配的角色");
                            return;
                        }

                        var role_list = new Array();
                        $("input:checkbox[name='role']:checked").each(function(i){
                            role_list[i] = $(this).val();
                        });
                        data.field.role = role_list.join(",");
                        console.log(data.field);
                        $.ajax({
                            url:"/registercheck/tongguo",
                            async: false,
                            type:"POST",
                            dataType: "text",
                            data:data.field,
                            success: function(data){
                                if(data==="error"){
                                    layer.close(index);
                                    layer.msg('审核失败！', {icon: 2});
                                }else if(data==="success"){
                                    layer.msg('审核成功！', {icon: 1});
                                    setTimeout("",1000);
                                    self.location="/register_check_list";
                                }
                            }
                        });
                        return false;
                    });
                    $('#check_tg_submit').click();

                }
                ,btn2 : function(index, layero) { // 取消按钮回调函数
                    layer.close(index); // 关闭弹出层
                }
            });
        });


        $('#butongguo').click(function () {
            layer.open({
                type: 1
                ,skin: 'layui-layer-molv'
                ,area: ['40%', '40%']
                ,title: ['请填写审核意见','font-size:18px']
                ,btn: ['审核不通过', '取消']
                ,shadeClose: true
                ,shade: 0 //遮罩透明度
                ,maxmin: true //允许全屏最小化
                ,content:$("#check_butg")  //弹窗路径
                ,success:function(layero,index){
                    $("#userid_b").attr("value",$('#userid').val());
                    form.render(null, 'check_butg_form');
                }
                ,yes : function(index, layero) { // 确认按钮回调函数
                    form.on('submit(check_butg_submit)', function(data) {
                        $.ajax({
                            url:"/registercheck/butongguo",
                            async: false,
                            type:"POST",
                            dataType: "text",
                            data:data.field,
                            success: function(data){
                                if(data==="error"){
                                    layer.close(index);
                                    layer.msg('审核失败！', {icon: 2});
                                }else if(data==="success"){
                                    layer.msg('审核成功！', {icon: 1});
                                    setTimeout("",1000);
                                    self.location="/register_check_list";
                                }
                            }
                        });
                        return false;
                    });
                    $('#check_butg_submit').click();

                }
                ,btn2 : function(index, layero) { // 取消按钮回调函数
                    layer.close(index); // 关闭弹出层
                }
            });
        });

    });


</script>
<script type="text/javascript" src="/static/js/hangye.js"></script>
</body>
</html>